package com.searchschool.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity (name="TYPE")
@Table (name="tbtype")
public class Type implements Serializable {
	
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue ( strategy=GenerationType.TABLE, generator="TYPE_GEN")
	@TableGenerator(name="TYPE_GEN", table="tbsequence", pkColumnName="SEQ_NAME", valueColumnName="SEQ_COUNT", pkColumnValue="TYPE", allocationSize=1	)
	
	private int idtype;
	private String nametype;
	@OneToOne ( optional=true, cascade=CascadeType.ALL,
		    mappedBy="type" , targetEntity=School.class
		)
	private School school;


	public Type() {
		
	}

	public Type(String nametype, School school) {
		super();
		this.nametype = nametype;
		this.school = school;
	}

	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}

	public int getIdtype() {
		return idtype;
	}

	public void setIdtype(int idtype) {
		this.idtype = idtype;
	}

	public String getNametype() {
		return nametype;
	}

	public void setNametype(String nametype) {
		this.nametype = nametype;
	}
}
